function [degreeN] = Example2(pointX, tol, maxIter)
%EXAMPLE2 Computed the minimum value of Taylor Polinomials to approximated
%ln(x) to a certain error tolerance.

N=1;
y=pointX-1;
taylorSum=0;
taylorPower=y;
taylorTerm=y;
taylorSign=-1;

while N<maxIter
    taylorSign=-taylorSign;
    taylorSum=taylorSum+taylorSign*taylorTerm;
    
    taylorPower=taylorPower*y;
    taylorTerm=taylorPower/(N+1);
    
    if abs(taylorTerm)<tol
        degreeN=N;
        return
    else
        N=N+1;
    end
end

disp('Method failed')
degreeN=[];

end

